@echo off
goto endTitle
============================================================================

    Surveyor Command Line tests

    Sanity-check smoke tests that exercise Survreyor from a command-shell.

    Almost all Surveyor code can be exercised through system_test.py,
    which is a better place to build out most tests.

============================================================================
 Copyright 2010, Matt Peloquin and Construx. This file is part of Code
 Surveyor, covered under GNU GPL v3 and is distributed WITHOUT ANY WARRANTY
============================================================================
:endTitle

REM  Allow for Python version to be passed on command line
if !%1==! (
    SET PYTHON=
) else (
    SET PYTHON=%1
)
echo.
echo  Python running from: %PYTHON%
echo.
SET SURVEYOR=..\surveyor\surveyor.py
SET TESTS=%~p0

echo ===============================================================

call %PYTHON% %SURVEYOR%  -t -z
if ERRORLEVEL 1 goto ERR

echo ===============================================================

call %PYTHON% %SURVEYOR% -?
if NOT ERRORLEVEL 1 goto ERR

call %PYTHON% %SURVEYOR% -? s az
if NOT ERRORLEVEL 1 goto ERR

echo ===============================================================

cd %TESTS%\output
call %PYTHON% ..\%SURVEYOR% ..\*.bat %TESTS%\static\*.py .\*.xml -o CmdLineTest1.csv -sd static -sf *.bat -sb -p -v -w 2 -e 50 -q -y 5 5 5 Main cmdlineapp -z2
if ERRORLEVEL 1 goto ERR
cd %TESTS%

echo ===============================================================

call %PYTHON% %SURVEYOR% static -d scripts -z2fmq %TESTS%\output\CmdLineTests.dbg -f *.nbnc -r xml
if ERRORLEVEL 1 goto ERR

call %PYTHON% %SURVEYOR% -p -c surveyor.examples -o %TESTS%\output\CmdLineTest2.csv ..
if ERRORLEVEL 1 goto ERR

echo ===============================================================

call %PYTHON% %SURVEYOR% BAD_DIR\FileName
if NOT ERRORLEVEL 1 goto ERR

goto SUCCESS

:ERR
echo.
echo ===============================
echo  ERRORS in Command Line tests!
echo ===============================
echo.
(SET SURVEYOR_CMD_LINE_TEST_SUCCESS=)
goto END

:SUCCESS
echo.
echo ================================
echo  Command Line tests successful!
echo ================================
echo.
(SET SURVEYOR_CMD_LINE_TEST_SUCCESS=1)

:END



